﻿using System.IO;
using System.Windows;
using WpfApp1.Model;

namespace WpfApp1
{
    /// <summary>
    /// InputData.xaml 的交互逻辑
    /// </summary>
    public partial class InputData : Window
    {
        public InputData()
        {
            InitializeComponent();
            DataContext = GlobalNotice.notice;
        }

        private void Fileenter_Click(object sender, RoutedEventArgs e)
        {
            string destfile = GlobalNotice.notice.Dest_dictionary + @"\" + GlobalNotice.notice.Input;
            bool file_exist = (new FileInfo(destfile)).Exists;
            if (!file_exist)
            {
                Close();
            }
            else
            {
                GlobalNotice.notice.Notice += "\n文件已经存在：" + destfile + "\n请对文件重新进行命名";
            }
        }

        private void Filecancel_Click(object sender, RoutedEventArgs e)
        {
            GlobalNotice.notice.Is_cancel = true;
            Close();
        }

        private void Filejump_Click(object sender, RoutedEventArgs e)
        {
            GlobalNotice.notice.Is_jump = true;
            Close();
        }

        private void ScrollToBottom()
        {
            scroll.ScrollToEnd();
        }

        private void ScrollToBottom(object sender, SizeChangedEventArgs e)
        {
            scroll.ScrollToEnd();
        }
    }
}
